<?php
declare(strict_types=1);

namespace Service\OrderService;

use Service\BaseService;
use App\Model\BbcModel\OrderLog;
use Service\Code\Normal;


class OrderLogService extends BaseService
{
    
    
    public function addLog(array $param) {
        $sql = [];
        if(empty($param['order_id'])){
            return Normal::returnCode(Normal::FAIL,"订单id必传");
        }
        $sql['order_id'] = $param['order_id'];
        $sql['order_status'] = isset($param['order_status'])?$param['order_status']:'';
        $sql['msg'] = !empty($param['msg'])?$param['msg']:'系统操作';
        if(!empty($param['mid'])){
            $sql['user'] = $param['mid'];
            $sql['role'] = '用户';
        }elseif (!empty($param['manager_id'])){
            $sql['user'] = $param['manager_id'];
            $sql['role'] = '卖家';
        }else{
            $sql['user'] = 0;
            $sql['role'] = '系统';
        }
        $sql['time'] = time();
        $result=OrderLog::instance()->add($sql);
        return Normal::returnCode(Normal::SUC,"成功",$result);
    }
}